﻿Public Class frmAllCare
    Public TempAermod As New CAermod.Aermod
    Public FileName As String
    Private Sub frmAllCare_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Me.EFlex1.Cols.Count = TempAermod.Receptor.DiscCarts.Length + 2
        Dim nCount As Integer
        '先找出总的数据记录的个数
        Dim Post As New CAermod.PostResult20
        nCount = Post.GetDataCount(TempAermod.Control, TempAermod.Receptor, TempAermod.Control.AllPolluts.AllSelectPollut(0).Dispersion.DEPOS, FileName, "09292")
        Me.EFlex1.Rows.Count = nCount + 1 + 3
        Me.EFlex1.SetData(0, 0, "序号")
        For i As Integer = 0 To TempAermod.Receptor.DiscCarts.Length - 1
            Me.EFlex1.SetData(0, i + 1, TempAermod.Receptor.DiscCarts(i).Name)
        Next
        Me.EFlex1.SetData(0, TempAermod.Receptor.DiscCarts.Length + 1, "时刻")

        Dim sum(TempAermod.Receptor.DiscCarts.Length - 1) As Double
        For i As Integer = 0 To nCount - 1
            Me.EFlex1.SetData(i + 1, 0, i + 1)
            Dim OnePost As CAermod.PostFineBinResult = Post.GetDataPostBin(TempAermod.Control, TempAermod.Receptor, TempAermod.Control.AllPolluts.AllSelectPollut(0).Dispersion.DEPOS, i, FileName, "09292")
            For j As Integer = 0 To TempAermod.Receptor.DiscCarts.Length - 1
                Me.EFlex1.SetData(i + 1, j + 1, FormatNumber(OnePost.m_CareData(j).con / 1000, 11))
                sum(j) += OnePost.m_CareData(j).con / 1000
            Next
            Me.EFlex1.SetData(i + 1, TempAermod.Receptor.DiscCarts.Length + 1, OnePost.m_dateD)
        Next
        Me.EFlex1.SetData(nCount + 1, 0, "合计")
        For j As Integer = 0 To TempAermod.Receptor.DiscCarts.Length - 1
            Me.EFlex1.SetData(nCount + 1, j + 1, FormatNumber(sum(j), 9))
        Next
        Me.EFlex1.SetData(nCount + 2, 0, "平均")
        For j As Integer = 0 To TempAermod.Receptor.DiscCarts.Length - 1
            Me.EFlex1.SetData(nCount + 2, j + 1, FormatNumber(sum(j) / nCount, 9))
        Next
        EFlex1.AllowSorting = C1.Win.C1FlexGrid.AllowSortingEnum.None
        EFlex1.AllowResizing = C1.Win.C1FlexGrid.AllowResizingEnum.Columns
        EFlex1.AllowDragging = C1.Win.C1FlexGrid.AllowDraggingEnum.None

        EFlex1.AutoSizeCols()
    End Sub
End Class